package com.lyj;

import com.lyj.entity.User;
import com.lyj.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * Created by lyj on 2018/11/15.
 */
@RestController
@RequestMapping("/provider/user")
public class UserProviderController {

    @Autowired
    private UserService userService;

    @GetMapping("/get/{username}")
    public User getOrder(@PathVariable String username) {
        return userService.getByUserName(username);
    }

    @GetMapping("/get/list")
    public List<User> getAll() {
        return userService.findAll();
    }

}
